Repository navigation
Parse output and stream as Open Responses for all models in MLXChatExample app - #475
Closed
DePasqualeOrg wants to merge 8 commits into
Closed
DePasqualeOrg wants to merge 8 commits into
DePasqualeOrg wants to merge 8 commits into
Conversation
This was referenced May 1, 2026
JSONToolCallParser: accept stringified
arguments field (#169, Granite 4)
ml-explore/mlx-swift-lm#252
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Building on the changes in PR #474, this PR demonstrates how Swift LM Response Parser enables output parsing and streaming as Open Responses for the full range of models implemented in MLX Swift LM.
There are currently model-implementation issues with some of the models available in the app (notably Gemma 3n and Gemma 4, for which there are open PRs), and some of the smaller, less-recent models aren't reliable for tool use or aren't capable of it at all. But the app can now serve as a testing ground for reasoning and tool use in a variety of models.
I've added two tools with no side effects for demonstration purposes:
get_current_datetimeandsave_file(the latter of which is a no-op but showcases streaming tool calls).The streamed Open Responses items make it possible to represent the interleaved reasoning and tool-use output emitted by many newer models in real time. The app now shows these content blocks in the correct sequence in the UI. Notably, this includes streaming tool-use content.
I'd like to test Swift LM Response Parser with a broader range of models. The library includes an integration with MLX Swift LM, which is used in the example app, so it should be easy to integrate into any project using MLX Swift LM. If you're able to try it out, please respond with your feedback here or in the repo so that I can continue to improve it.
trimmed.mov